Skip to content

Add as_unsigned_integer_with_truncation to FiniteF64 - #768

Open
debangshu919 wants to merge 1 commit into
boa-dev:mainfrom
debangshu919:unsigned-trunc
Open

debangshu919 wants to merge 1 commit into
boa-dev:mainfrom
debangshu919:unsigned-trunc

Conversation

@debangshu919

Copy link
Copy Markdown

Summary

  • Adds FiniteF64::as_unsigned_integer_with_truncation, which truncates toward zero into an unsigned integer. A truncated value below 0 returns a range error ("integer must be non-negative."). 0 is accepted, including values in (-1, 0) such as -0.5.
  • Values above T::max_value() saturate through the existing as_integer_with_truncation helper. Time constructors are unchanged.
  • Closes Add an as_unsigned_integer_with_truncation method to FiniteF64 #431

Test plan

  • cargo test -p temporal --lib primitive
  • cargo fmt --all -- --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an as_unsigned_integer_with_truncation method to FiniteF64

1 participant